#include "MkRwLock.h"

CMkRwLock::CMkRwLock()
{
#ifdef _WIN32
	//InitializeSRWLock(&m_mutex);
#else
	pthread_rwlock_init(&m_mutex, NULL);
#endif
}

CMkRwLock::~CMkRwLock()
{
#ifdef _WIN32
#else
	pthread_rwlock_destroy(&m_mutex);
#endif
}

void CMkRwLock::RLock()
{
#ifdef _WIN32
	//quireSRWLockShared(&m_mutex);
    m_mutex.lock_shared();
#else
	pthread_rwlock_rdlock(&m_mutex);
#endif
}

void CMkRwLock::RUnlock()
{
#ifdef _WIN32
//eleaseSRWLockShared(&m_mutex);
    m_mutex.unlock_shared();
#else
	pthread_rwlock_unlock(&m_mutex);
#endif
}

void CMkRwLock::WLock()
{
#ifdef _WIN32
	//AcquireSRWLockExclusive(&m_mutex);
    m_mutex.lock();
#else
	pthread_rwlock_wrlock(&m_mutex);
#endif
}

void CMkRwLock::WUnlock()
{
#ifdef _WIN32
	//ReleaseSRWLockExclusive(&m_mutex);
    m_mutex.unlock();
#else
	pthread_rwlock_unlock(&m_mutex);
#endif
}